package com.csdj.x315springboot.config;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MybatisPlusConfig {

    public static void main(String[] args) {
        String projectPath = System.getProperty("user.dir");
        FastAutoGenerator.create("jdbc:mysql://localhost:3306/test","admin","123456")
                .globalConfig(builder ->{
                    builder.author("cloud")
                            .outputDir(projectPath + "/src/main/java");
                })
                .packageConfig(builder -> {
                    builder.parent("com.csdj.x315springboot")
                            .xml("mapper");
//                            .pathInfo(Collections.singletonMap(OutputFile.mapperXml,projectPath + "/src/main/java"));
                })
                .strategyConfig(builder -> {
                    builder.addInclude("user");
                })
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }


}
